package com.gxdf.uc.data;

import java.util.ArrayList;

import android.content.Context;


public class GxdfFieldFactory {
	
	Context context;
	private static GxdfFieldFactory instance = new GxdfFieldFactory();

	private GxdfFieldFactory() {
	}	
	
	public static GxdfFieldFactory getInstance(){
		if(instance==null)
			instance = new GxdfFieldFactory();
		return instance;
	}
	
	public GxdfField getField(Context context,Field f) {
		this.context = context;
		GxdfField gxfield = null;

		if (f.getType().getRenderToString().equals("TEXTBOX")) {
			gxfield = new GxdfEditText(this.context, f); //Todo: Saca el valor vacio			

		} else if (f.getType().getRenderToString().equals("RADIO")) {
			
			gxfield = new GxdfRadioGroup(this.context, f);

		} else if (f.getType().getRenderToString().equals("CHECK")) {

			//gxfield = new GxdfCheckBox(this.context, f);

		}else if(f.getType().getRenderToString().equals("COMBO")){
			
						
			gxfield = new GxdfSpinner(this.context, f);
			
		}
		else if(f.getType().getRenderToString().equals("TEXTBOX_LIST")){		
			
			gxfield = new GxdfGroupView(this.context,f);
			
		}

		return gxfield;

	}

}
